CC=gcc
CPP=c++
PYINCLUDE=-I/usr/include/python2.5 -I/usr/include/python2.4
OFLAGS=-c -Wall -O4 -fPIC -g
SOFLAGS=-shared -Wall -O4 -fPIC -lm $(PYINCLUDE)
OFILES=*.o tinyxml/*.o cocos_arnold/*.o


all: controller_py

alles: subfolders all

subfolders:
		(cd tinyxml; make all)
		(cd cocos_arnold; make all)
pamimage:
		$(CPP) $(OFLAGS) -pedantic PamImage.cpp
config:
		$(CPP) $(OFLAGS) -pedantic Config.cpp
preprocessor:
		$(CPP) $(OFLAGS) -pedantic Preprocessor.cpp
segmentator:
		$(CPP) $(OFLAGS) -pedantic Segmentator.cpp
database:
		$(CPP) $(OFLAGS) -pedantic Database.cpp
featurefunctions:
		$(CPP) $(OFLAGS) -pedantic FeatureFunctions.cpp
tester:
		$(CPP) $(OFLAGS) -pedantic Test.cpp
word:
		$(CPP) $(OFLAGS) -pedantic Word.cpp
wordsline:
		$(CPP) $(OFLAGS) -pedantic WordsLine.cpp
io:
		$(CPP) $(OFLAGS) -pedantic io.cpp
controller:
		$(CPP) $(OFLAGS) -pedantic Controller.cpp
drawlib:
		$(CPP) $(OFLAGS) -pedantic drawlib.cpp
cocos:
		$(CPP) $(OFLAGS) -pedantic cocoslib.cpp

controller_py: pamimage config preprocessor segmentator database featurefunctions tester word wordsline io controller drawlib cocos
		swig -c++ -python controller.i
		$(CPP) $(SOFLAGS) $(OFILES) controller_wrap.cxx -o _controller.so
		rm -f controller_wrap.cxx

clean:
		rm -f *.o *.so controller.py *.cxx *.pyc
		rm -r outputImages output/*
schoon:
		rm -f *.o *.so controller.py *.cxx *.pyc
		rm -r outputImages output/*
		(cd cocos_arnold; make clean)
		(cd tinyxml; make clean)